﻿// using GameCreator.Characters;
// using Gp.GCX;
// using Gp.Scripts.Core;
// using UnityEngine;
//
// namespace HutongGames.PlayMaker.Actions {
//     [ActionCategory("Gp")]
//     [Tooltip("让角色移动到指定位置")]
//     public class MoveCharacterAc : FsmStateAction {
//         [RequiredField]
//         [Tooltip("目标角色的占位符")]
//         public PlaceHolder targetObj;
//         
//         public CharacterMoveAc.MoveTo? moveTo = CharacterMoveAc.MoveTo.Instant;
//
//         private Character character;
//         
//         [Range(0.0f, 5.0f)] [Tooltip("Threshold distance from the target that is considered as reached")]
//         public float stopThreshold = 0.0f;
//
//         public override void Reset() {
//             base.Reset();
//             targetObj = null;
//             moveTo = CharacterMoveAc.MoveTo.Instant;
//             character = null;
//             stopThreshold = 0;
//         }
//
//         public override void OnUpdate() {
//             base.OnUpdate();
//             try {
//                 character = targetObj.GetCharacter();
//             }
//             catch (CharacterNotFoundException e) {
//                 Debug.LogError(e.Message);
//             }
//
//
//             // 移动模式为“直接移动”时，直接坐标赋值
//             if (moveTo == CharacterMoveAc.MoveTo.Instant) {
//                 character.transform.position = targetObj.transform.position;
//             }
//
//             character.characterLocomotion.SetTarget(targetObj.transform.position, null,
//                 Mathf.Max(0, this.stopThreshold));
//         }
//     }
// }